home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / macros / latex209 / contrib / harvard / agsm.bst < prev    next >
Text File  |  1994-06-16  |  25KB  |  1,337 lines

  1. % BibTeX standard bibliography style `agsm' (one of the harvard family)
  2.     % version 0.99a for BibTeX versions 0.99a or later, LaTeX version 2.09.
  3.     % Copyright (C) 1991, all rights reserved.
  4.     % Copying of this file is authorized only if either
  5.     % (1) you make absolutely no changes to your copy, including name, or
  6.     % (2) if you do make changes, you name it something other than
  7.     % btxbst.doc, plain.bst, unsrt.bst, alpha.bst, abbrv.bst, agsm.bst,
  8.         % dcu.bst or kluwer.bst.
  9.     % This restriction helps ensure that all standard styles are identical.
  10.     % The file harvard.tex has the documentation for this style.
  11.  
  12. % ACKNOWLEDGEMENT:
  13. %   This document is a modified version of alpha.bst to which it owes much of
  14. %   its functionality.
  15.  
  16. % AUTHOR
  17. %   Peter Williams, Key Centre for Design Quality, Sydney University
  18. %   e-mail: peterw@archsci.arch.su.oz.au
  19.  
  20. ENTRY
  21.   { address
  22.     author
  23.     booktitle
  24.     chapter
  25.     edition
  26.     editor
  27.     howpublished
  28.     institution
  29.     journal
  30.     key
  31.     month
  32.     note
  33.     number
  34.     organization
  35.     pages
  36.     publisher
  37.     school
  38.     series
  39.     title
  40.     type
  41.     volume
  42.     year
  43.   }
  44.   { field.used etal.allowed etal.required} %%%XXX change
  45.   { extra.label sort.label list.year }
  46.  
  47. INTEGERS { output.state before.all mid.sentence after.sentence after.block }
  48.  
  49. FUNCTION {init.state.consts}
  50. { #0 'before.all :=
  51.   #1 'mid.sentence :=
  52.   #2 'after.sentence :=
  53.   #3 'after.block :=
  54. }
  55.  
  56. STRINGS { s t f }
  57.  
  58. FUNCTION {output.nonnull}
  59. { 's :=
  60.   output.state mid.sentence =
  61.     { ", " * write$ }
  62.     { output.state after.block =
  63.     { add.period$ write$
  64.       newline$
  65.       "\newblock " write$
  66.     }
  67.     { output.state before.all =
  68.         'write$
  69.         { add.period$ " " * write$ }
  70.       if$
  71.     }
  72.       if$
  73.       mid.sentence 'output.state :=
  74.     }
  75.   if$
  76.   s
  77. }
  78.  
  79. FUNCTION {output}
  80. { duplicate$ empty$
  81.     'pop$
  82.     'output.nonnull
  83.   if$
  84. }
  85.  
  86. FUNCTION {output.check}
  87. { 't :=
  88.   duplicate$ empty$
  89.     { pop$ "empty " t * " in " * cite$ * warning$ }
  90.     'output.nonnull
  91.   if$
  92. }
  93.  
  94. FUNCTION {item.check}
  95. { 't :=
  96.   empty$
  97.     { "empty " t * " in " * cite$ * warning$ }
  98.     { skip$ }
  99.   if$
  100. }
  101.  
  102. FUNCTION {fin.entry}
  103. { add.period$
  104.   write$
  105.   newline$
  106. }
  107.  
  108. FUNCTION {new.block}
  109. { output.state before.all =
  110.     'skip$
  111.     { after.block 'output.state := }
  112.   if$
  113. }
  114.  
  115. FUNCTION {not}
  116. {   { #0 }
  117.     { #1 }
  118.   if$
  119. }
  120.  
  121. FUNCTION {and}
  122. {   'skip$
  123.     { pop$ #0 }
  124.   if$
  125. }
  126.  
  127. FUNCTION {or}
  128. {   { pop$ #1 }
  129.     'skip$
  130.   if$
  131. }
  132.  
  133. FUNCTION {field.or.null}
  134. { duplicate$ empty$
  135.     { pop$ "" }
  136.     'skip$
  137.   if$
  138. }
  139.  
  140. FUNCTION {emphasize}
  141. { duplicate$ empty$
  142.     { pop$ "" }
  143.     { "{\em " swap$ * "}" * }
  144.   if$
  145. }
  146.  
  147. FUNCTION {embolden}
  148. { duplicate$ empty$
  149.     { pop$ "" }
  150.     { "{\bf " swap$ * "}" * }
  151.   if$
  152. }
  153.  
  154. FUNCTION {quote}
  155. { duplicate$ empty$
  156.     { pop$ "" }
  157.     { "`" swap$ * "'" * }
  158.   if$
  159. }
  160.  
  161. INTEGERS { nameptr namesleft numnames }
  162.  
  163. FUNCTION {format.names}
  164. { 's :=
  165.   'f :=
  166.   #1 'nameptr :=
  167.   s num.names$ 'numnames :=
  168.   numnames 'namesleft :=
  169.     { namesleft #0 > }
  170.     { s nameptr f format.name$ 't :=
  171.       nameptr #1 >
  172.     { namesleft #1 >
  173.         { ", " * t * }
  174.         { t "others" =
  175.         { " et~al." * }
  176.         { " \harvardand\ " * t * }
  177.           if$
  178.         }
  179.       if$
  180.     }
  181.     't
  182.       if$
  183.       nameptr #1 + 'nameptr :=
  184.       namesleft #1 - 'namesleft :=
  185.     }
  186.   while$
  187. }
  188.  
  189. FUNCTION {format.authors}
  190. { author empty$
  191.     { "" }
  192.     { "{vv~}{ll}{, jj}{, f.}" author format.names }
  193.   if$
  194. }
  195.  
  196. FUNCTION {format.editors}
  197. { editor empty$
  198.     { "" }
  199.     { "{vv~}{ll}{, jj}{, f.}" editor format.names
  200.       editor num.names$ #1 >
  201.     { ", eds" * }
  202.     { ", ed." * }
  203.       if$
  204.     }
  205.   if$
  206. }
  207.  
  208. FUNCTION {format.editors.reverse}
  209. { editor empty$
  210.     { "" }
  211.     { "{f.~}{vv~}{ll}{, jj}" editor format.names
  212.       editor num.names$ #1 >
  213.     { ", eds" * }
  214.     { ", ed." * }
  215.       if$
  216.     }
  217.   if$
  218. }
  219.  
  220. FUNCTION {format.title}
  221. { title empty$
  222.     { "" }
  223.     { title "t" change.case$ }
  224.   if$
  225. }
  226.  
  227. FUNCTION {n.dashify}
  228. { 't :=
  229.   ""
  230.     { t empty$ not }
  231.     { t #1 #1 substring$ "-" =
  232.     { t #1 #2 substring$ "--" = not
  233.         { "--" *
  234.           t #2 global.max$ substring$ 't :=
  235.         }
  236.         {   { t #1 #1 substring$ "-" = }
  237.         { "-" *
  238.           t #2 global.max$ substring$ 't :=
  239.         }
  240.           while$
  241.         }
  242.       if$
  243.     }
  244.     { t #1 #1 substring$ *
  245.       t #2 global.max$ substring$ 't :=
  246.     }
  247.       if$
  248.     }
  249.   while$
  250. }
  251.  
  252. FUNCTION {format.btitle}
  253. { title emphasize
  254. }
  255.  
  256. FUNCTION {tie.or.space.connect}
  257. { duplicate$ text.length$ #3 <
  258.     { "~" }
  259.     { " " }
  260.   if$
  261.   swap$ * *
  262. }
  263.  
  264. FUNCTION {either.or.check}
  265. { empty$
  266.     'pop$
  267.     { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  268.   if$
  269. }
  270.  
  271. FUNCTION {format.bvolume}
  272. { volume empty$
  273.     { "" }
  274.     { "Vol." volume tie.or.space.connect
  275.       series empty$
  276.     'skip$
  277.     { " of " * series emphasize * }
  278.       if$
  279.       "volume and number" number either.or.check
  280.     }
  281.   if$
  282. }
  283.  
  284. FUNCTION {format.number.series}
  285. { volume empty$
  286.     { number empty$
  287.     { series field.or.null }
  288.     { output.state mid.sentence =
  289.         { "number" }
  290.         { "Number" }
  291.       if$
  292.       number tie.or.space.connect
  293.       series empty$
  294.         { "there's a number but no series in " cite$ * warning$ }
  295.         { " {\em in} " * series quote * }
  296.       if$
  297.     }
  298.       if$
  299.     }
  300.     { "" }
  301.   if$
  302. }
  303.  
  304. FUNCTION {format.edition}
  305. { edition empty$
  306.     { "" }
  307.     { output.state mid.sentence =
  308.     { edition "l" change.case$ " edn" * }
  309.     { edition "t" change.case$ " edn" * }
  310.       if$
  311.     }
  312.   if$
  313. }
  314.  
  315. INTEGERS { multiresult }
  316.  
  317. FUNCTION {multi.page.check}
  318. { 't :=
  319.   #0 'multiresult :=
  320.     { multiresult not
  321.       t empty$ not
  322.       and
  323.     }
  324.     { t #1 #1 substring$
  325.       duplicate$ "-" =
  326.       swap$ duplicate$ "," =
  327.       swap$ "+" =
  328.       or or
  329.     { #1 'multiresult := }
  330.     { t #2 global.max$ substring$ 't := }
  331.       if$
  332.     }
  333.   while$
  334.   multiresult
  335. }
  336.  
  337. FUNCTION {format.pages}
  338. { pages empty$
  339.     { "" }
  340.     { pages multi.page.check
  341.     { "pp.~" pages n.dashify * }
  342.     { "p.~" pages * }
  343.       if$
  344.     }
  345.   if$
  346. }
  347.  
  348. FUNCTION {format.vol.num.pages}
  349. { volume embolden field.or.null
  350.   number empty$
  351.     'skip$
  352.     { "(" number * ")" * *
  353.       volume empty$
  354.     { "there's a number but no volume in " cite$ * warning$ }
  355.     'skip$
  356.       if$
  357.     }
  358.   if$
  359.   pages empty$
  360.     'skip$
  361.     { duplicate$ empty$
  362.     { pop$ format.pages }
  363.     { ",~" * pages n.dashify * }
  364.       if$
  365.     }
  366.   if$
  367. }
  368.  
  369. FUNCTION {format.chapter.pages}
  370. { chapter empty$
  371.     'format.pages
  372.     { type empty$
  373.     { "chapter" }
  374.     { type "l" change.case$ }
  375.       if$
  376.       chapter tie.or.space.connect
  377.       pages empty$
  378.     'skip$
  379.     { ", " * format.pages * }
  380.       if$
  381.     }
  382.   if$
  383. }
  384.  
  385. FUNCTION {format.in.ed.booktitle}
  386. { booktitle empty$
  387.     { "" }
  388.     { editor empty$
  389.     { "{\em in} " booktitle quote * }
  390.     { "{\em in} " format.editors.reverse * ", " * booktitle quote * }
  391.       if$
  392.     }
  393.   if$
  394. }
  395.  
  396. FUNCTION {empty.misc.check}
  397. { author empty$ title empty$ howpublished empty$
  398.   month empty$ year empty$ note empty$
  399.   and and and and and
  400.   key empty$ not and
  401.     { "all relevant fields are empty in " cite$ * warning$ }
  402.     'skip$
  403.   if$
  404. }
  405.  
  406. FUNCTION {format.thesis.type}
  407. { type empty$
  408.     'skip$
  409.     { pop$
  410.       type "t" change.case$
  411.     }
  412.   if$
  413. }
  414.  
  415. FUNCTION {format.tr.number}
  416. { type empty$
  417.     { "Technical Report" }
  418.     'type
  419.   if$
  420.   number empty$
  421.     { "t" change.case$ }
  422.     { number tie.or.space.connect }
  423.   if$
  424. }
  425.  
  426. FUNCTION {format.article.crossref}
  427. { key empty$
  428.     { journal empty$
  429.     { "need key or journal for " cite$ * " to crossref " * crossref *
  430.       warning$
  431.       ""
  432.     }
  433.     { "in {\em " journal * "\/} \cite{" * crossref * "}" *}
  434.       if$
  435.     }
  436.     { "{\em in} \citeasnoun{" crossref * "}" * }
  437.   if$
  438.  
  439. }
  440.  
  441. FUNCTION {format.book.crossref}
  442. { volume empty$
  443.     { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
  444.       "in "
  445.     }
  446.     { "Vol." volume tie.or.space.connect
  447.       " of " *
  448.     }
  449.   if$
  450.   editor empty$
  451.   editor field.or.null author field.or.null =
  452.   or
  453.     { key empty$
  454.     { series empty$
  455.         { "need editor, key, or series for " cite$ * " to crossref " *
  456.           crossref * warning$
  457.           "" *
  458.         }
  459.         { "{\em " * series * "\/} \cite{" * crossref * "}" *}
  460.       if$
  461.     }
  462.     { " \citeasnoun{" * crossref * "}" * }
  463.       if$
  464.     }
  465.     { " \citeasnoun{" * crossref * "}" * }
  466.   if$
  467. }
  468.  
  469. FUNCTION {format.incoll.inproc.crossref}
  470. { editor empty$
  471.   editor field.or.null author field.or.null =
  472.   or
  473.     { key empty$
  474.     { booktitle empty$
  475.         { "need editor, key, or booktitle for " cite$ * " to crossref " *
  476.           crossref * warning$
  477.           ""
  478.         }
  479.         { "in {\em " booktitle * "\/}" * " \cite{" * crossref * "}" *}
  480.       if$
  481.     }
  482.     { "{\em in} \citeasnoun{" crossref * "}" * }
  483.       if$
  484.     }
  485.     { "{\em in} \citeasnoun{" crossref * "}" * }
  486.   if$
  487.   
  488. }
  489.  
  490. INTEGERS { len }
  491.  
  492. FUNCTION {chop.word}
  493. { 's :=
  494.   'len :=
  495.   s #1 len substring$ =
  496.     { s len #1 + global.max$ substring$ }
  497.     's
  498.   if$
  499. }
  500.  
  501. INTEGERS { ind tsslen }
  502.  
  503. STRINGS { tss ret rss istr }
  504.  
  505. FUNCTION {replace.substring}{
  506.   'rss :=
  507.   'tss :=
  508.   'istr :=
  509.   "" 'ret :=
  510.   tss text.length$ 'tsslen :=
  511.   #1 'ind :=
  512.     { istr ind tsslen substring$ "" = not }
  513.     { istr ind tsslen substring$ tss =
  514.         { ret rss * 'ret :=
  515.           ind tsslen + 'ind :=
  516.         }
  517.         { ret istr ind #1 substring$ * 'ret :=
  518.           ind #1 + 'ind :=
  519.         }
  520.       if$
  521.     }
  522.   while$
  523.   ret
  524. }
  525.  
  526. FUNCTION {format.lab.names.abbr}
  527. { 's :=
  528.   s num.names$ 'numnames :=
  529.   numnames #1 >
  530.     { numnames #2 >
  531.     { s #1 "{vv~}{ll}" format.name$ " et~al." * }
  532.     { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  533.             { s #1 "{vv~}{ll}" format.name$ " et~al." * }
  534.         { s #1 "{vv~}{ll}" format.name$ " \harvardand\ " *
  535.               s #2 "{vv~}{ll}" format.name$ * 
  536.             }
  537.           if$
  538.         }
  539.       if$
  540.     }
  541.     { s #1 "{vv~}{ll}" format.name$ }
  542.   if$
  543. }
  544.  
  545. FUNCTION {format.lab.names.full}
  546. { 's :=
  547.   #1 'nameptr :=
  548.   s num.names$ 'numnames :=
  549.   numnames 'namesleft :=
  550.     { namesleft #0 > }
  551.     { s nameptr "{vv~}{ll}" format.name$ 't :=
  552.       nameptr #1 >
  553.     { namesleft #1 >
  554.         { ", " * t * }
  555.         { t "others" =
  556.         { " et~al." * }
  557.         { " \harvardand\ " * t * }
  558.           if$
  559.         }
  560.       if$
  561.     }
  562.     't
  563.       if$
  564.       nameptr #1 + 'nameptr :=
  565.       namesleft #1 - 'namesleft :=
  566.     }
  567.   while$
  568. }
  569.  
  570. INTEGERS { author.field editor.field organization.field title.field key.field }
  571.  
  572. FUNCTION {init.field.constants}
  573. { #0 'author.field :=
  574.   #1 'editor.field :=
  575.   #2 'organization.field :=
  576.   #3 'title.field :=
  577.   #4 'key.field :=
  578. }
  579.  
  580. FUNCTION {make.list.label}
  581. { author.field field.used =
  582.     { format.authors }
  583.     { editor.field field.used =
  584.         { format.editors }
  585.         { organization.field field.used =
  586.             { "The " #4 organization chop.word #3 text.prefix$ }
  587.             { title.field field.used =
  588.                 { format.btitle }
  589.                 { key.field field.used =
  590.                     { key #3 text.prefix$ }
  591.                     { "Internal error :001 on " cite$ * " label" * warning$ }
  592.                   if$
  593.                 }
  594.               if$
  595.             }
  596.           if$
  597.         }
  598.       if$
  599.     }
  600.   if$
  601. }
  602.  
  603. FUNCTION {make.full.label}
  604. { author.field field.used =
  605.     { author format.lab.names.full }
  606.     { editor.field field.used =
  607.         { editor format.lab.names.full }
  608.         { organization.field field.used =
  609.             { "The " #4 organization chop.word #3 text.prefix$ }
  610.             { title.field field.used =
  611.                 { format.btitle }
  612.                 { key.field field.used =
  613.                     { key #3 text.prefix$ }
  614.                     { "Internal error :001 on " cite$ * " label" * warning$ }
  615.                   if$
  616.                 }
  617.               if$
  618.             }
  619.           if$
  620.         }
  621.       if$
  622.     }
  623.   if$
  624. }
  625.  
  626. FUNCTION {make.abbr.label} %%%XXX change
  627. {
  628.   etal.allowed
  629.     { author.field field.used =
  630.         { author format.lab.names.abbr }
  631.         { editor.field field.used =
  632.             { editor format.lab.names.abbr }
  633.             { organization.field field.used =
  634.                 { "The " #4 organization chop.word #3 text.prefix$ }
  635.                 { title.field field.used =
  636.                     { format.btitle }
  637.                     { key.field field.used =
  638.                         { key #3 text.prefix$ }
  639.                         {"Internal error :001 on " cite$ * " label" * warning$ }
  640.                       if$
  641.                     }
  642.                   if$
  643.                 }
  644.               if$
  645.             }
  646.           if$
  647.         }
  648.       if$
  649.     }
  650.     { make.full.label }
  651.   if$
  652. }
  653.  
  654. FUNCTION {output.bibitem}
  655. { newline$
  656.   etal.allowed        %%%XXX change
  657.   etal.required
  658.   and
  659.     {
  660.       "\harvarditem[" write$
  661.       make.abbr.label write$
  662.       "]{" write$
  663.     }
  664.     {
  665.       "\harvarditem{" write$
  666.     }
  667.   if$
  668.   make.full.label write$
  669.   "}{" write$
  670.   list.year write$
  671.   "}{" write$
  672.   cite$ write$
  673.   "}" write$
  674.   newline$
  675.   ""
  676.   before.all 'output.state :=
  677. }
  678.  
  679. FUNCTION {list.label.output}
  680. { make.list.label " " * write$
  681. }
  682.  
  683. FUNCTION {article}
  684. { output.bibitem
  685.   list.label.output
  686.   " \harvardleft " list.year * "\harvardright " * output.nonnull
  687.   author "author" item.check
  688.   title.field field.used =
  689.     { skip$ }
  690.     { format.title quote "title" output.check }
  691.   if$
  692.   crossref missing$
  693.     { journal emphasize "journal" duplicate$ item.check
  694.       pages empty$
  695.         {
  696.           output
  697.         }
  698.         {
  699.           " " *
  700.           format.vol.num.pages * output
  701.         }
  702.       if$
  703.     }
  704.     { format.article.crossref output.nonnull
  705.       format.pages output
  706.     }
  707.   if$
  708.   new.block
  709.   note output
  710.   fin.entry
  711. }
  712.  
  713. FUNCTION {book}
  714. { output.bibitem
  715.   list.label.output
  716.   " \harvardleft " list.year * "\harvardright " * output.nonnull
  717.   author empty$
  718.     { editor "author and editor" item.check }
  719.     { crossref missing$
  720.     { "author and editor" editor either.or.check }
  721.     'skip$
  722.       if$
  723.     }
  724.   if$
  725.   title.field field.used =
  726.     { skip$ }
  727.     { format.btitle "title" output.check }
  728.   if$
  729.   crossref missing$
  730.     { format.bvolume output
  731.       format.number.series output
  732.       format.edition output
  733.       publisher "publisher" output.check
  734.       address output
  735.     }
  736.     { format.book.crossref output.nonnull
  737.       format.edition output
  738.     }
  739.   if$
  740.   new.block
  741.   note output
  742.   fin.entry
  743. }
  744.  
  745. FUNCTION {booklet}
  746. { output.bibitem
  747.   list.label.output
  748.   " \harvardleft " list.year * "\harvardright " * output.nonnull
  749.   title.field field.used =
  750.     { skip$ }
  751.     { format.title quote "title" output.check }
  752.   if$
  753.   howpublished output
  754.   address output
  755.   new.block
  756.   note output
  757.   fin.entry
  758. }
  759.  
  760. FUNCTION {inbook}
  761. { output.bibitem
  762.   list.label.output
  763.   " \harvardleft " list.year * "\harvardright " * output.nonnull
  764.   author empty$
  765.     { editor "author and editor" item.check }
  766.     { crossref missing$
  767.     { "author and editor" editor either.or.check }
  768.     'skip$
  769.       if$
  770.     }
  771.   if$
  772.   title.field field.used =
  773.     { skip$ }
  774.     { format.btitle "title" output.check }
  775.   if$
  776.   crossref missing$
  777.     { format.bvolume output
  778.       format.number.series output
  779.       format.edition output
  780.       publisher "publisher" output.check
  781.       address output
  782.     }
  783.     { format.book.crossref output.nonnull
  784.       format.edition output
  785.     }
  786.   if$
  787.   format.chapter.pages "chapter and pages" output.check
  788.   new.block
  789.   note output
  790.   fin.entry
  791. }
  792.  
  793. FUNCTION {incollection}
  794. { output.bibitem
  795.   list.label.output
  796.   " \harvardleft " list.year * "\harvardright " * output.nonnull
  797.   title.field field.used =
  798.     { skip$ }
  799.     { format.title "title" output.check }
  800.   if$
  801.   author "author" item.check
  802.   crossref missing$
  803.     { format.in.ed.booktitle "booktitle" output.check
  804.       format.edition output
  805.       format.bvolume output
  806.       format.number.series output
  807.       publisher "publisher" output.check
  808.       address output
  809.     }
  810.     { format.incoll.inproc.crossref output.nonnull
  811.     }
  812.   if$
  813.   format.chapter.pages output
  814.   new.block
  815.   note output
  816.   fin.entry
  817. }
  818.  
  819. FUNCTION {inproceedings}
  820. { output.bibitem
  821.   list.label.output
  822.   " \harvardleft " list.year * "\harvardright " * output.nonnull
  823.   title.field field.used =
  824.     { skip$ }
  825.     { format.title "title" output.check }
  826.   if$
  827.   author "author" item.check
  828.   crossref missing$
  829.     { format.in.ed.booktitle "booktitle" output.check
  830.       format.bvolume output
  831.       format.number.series output
  832.       address empty$
  833.     { organization output
  834.       publisher output
  835.     }
  836.     { organization output
  837.       publisher output
  838.           address output.nonnull
  839.      }
  840.       if$
  841.     }
  842.     { format.incoll.inproc.crossref output.nonnull
  843.     }
  844.   if$
  845.   format.pages output
  846.   new.block
  847.   note output
  848.   fin.entry
  849. }
  850.  
  851. FUNCTION {conference} { inproceedings }
  852.  
  853. FUNCTION {manual}
  854. { output.bibitem
  855.   list.label.output
  856.   " \harvardleft " list.year * "\harvardright " * output.nonnull
  857.   title.field field.used =
  858.     { skip$ }
  859.     { format.btitle "title" output.check }
  860.   if$
  861.   format.edition output
  862.   author empty$
  863.     { organization empty$
  864.     { address output }
  865.     'skip$
  866.       if$
  867.     }
  868.     { organization output
  869.       address output
  870.     }
  871.   if$
  872.   new.block
  873.   note output
  874.   fin.entry
  875. }
  876.  
  877. FUNCTION {mastersthesis}
  878. { output.bibitem
  879.   list.label.output
  880.   " \harvardleft " list.year * "\harvardright " * output.nonnull
  881.   author "author" item.check
  882.   title.field field.used =
  883.     { skip$ }
  884.     { format.title "title" output.check }
  885.   if$
  886.   "Master's thesis" format.thesis.type output.nonnull
  887.   school "school" output.check
  888.   address output
  889.   new.block
  890.   note output
  891.   fin.entry
  892. }
  893.  
  894. FUNCTION {misc}
  895. { output.bibitem
  896.   list.label.output
  897.   " \harvardleft " list.year * "\harvardright " * output.nonnull
  898.   title.field field.used =
  899.     { skip$ }
  900.     { format.title quote output }
  901.   if$
  902.   howpublished output
  903.   new.block
  904.   note output
  905.   fin.entry
  906.   empty.misc.check
  907. }
  908.  
  909. FUNCTION {phdthesis}
  910. { output.bibitem
  911.   list.label.output
  912.   " \harvardleft " list.year * "\harvardright " * output.nonnull
  913.   author "author" item.check
  914.   title.field field.used =
  915.     { skip$ }
  916.     { title "title" output.check }
  917.   if$
  918.   "PhD thesis" format.thesis.type output.nonnull
  919.   school "school" output.check
  920.   address output
  921.   new.block
  922.   note output
  923.   fin.entry
  924. }
  925.  
  926. FUNCTION {proceedings}
  927. { output.bibitem
  928.   list.label.output
  929.   " \harvardleft " list.year * "\harvardright " * output.nonnull
  930.   title.field field.used =
  931.     { skip$ }
  932.     { format.btitle "title" output.check }
  933.   if$
  934.   format.bvolume output
  935.   format.number.series output
  936.   address empty$
  937.     { editor empty$
  938.     { skip$ }
  939.     { organization output
  940.     }
  941.       if$
  942.       publisher output
  943.     }
  944.     { editor empty$
  945.     'skip$
  946.     { organization output }
  947.       if$
  948.       publisher output
  949.       address output.nonnull
  950.     }
  951.   if$
  952.   new.block
  953.   note output
  954.   fin.entry
  955. }
  956.  
  957. FUNCTION {techreport}
  958. { output.bibitem
  959.   list.label.output
  960.   " \harvardleft " list.year * "\harvardright " * output.nonnull
  961.   author "author" item.check
  962.   title.field field.used =
  963.     { skip$ }
  964.     { format.title "title" output.check }
  965.   if$
  966.   format.tr.number output.nonnull
  967.   institution "institution" output.check
  968.   address output
  969.   new.block
  970.   note output
  971.   fin.entry
  972. }
  973.  
  974. FUNCTION {unpublished}
  975. { output.bibitem
  976.   list.label.output
  977.   " \harvardleft " list.year * "\harvardright " * output.nonnull
  978.   author "author" item.check
  979.   title.field field.used =
  980.     { skip$ }
  981.     { format.title "title" output.check }
  982.   if$
  983.   note "note" output.check
  984.   fin.entry
  985. }
  986.  
  987. FUNCTION {default.type} { misc }
  988.  
  989. MACRO {jan} {"January"}
  990.  
  991. MACRO {feb} {"February"}
  992.  
  993. MACRO {mar} {"March"}
  994.  
  995. MACRO {apr} {"April"}
  996.  
  997. MACRO {may} {"May"}
  998.  
  999. MACRO {jun} {"June"}
  1000.  
  1001. MACRO {jul} {"July"}
  1002.  
  1003. MACRO {aug} {"August"}
  1004.  
  1005. MACRO {sep} {"September"}
  1006.  
  1007. MACRO {oct} {"October"}
  1008.  
  1009. MACRO {nov} {"November"}
  1010.  
  1011. MACRO {dec} {"December"}
  1012.  
  1013. MACRO {acmcs} {"ACM Computing Surveys"}
  1014.  
  1015. MACRO {acta} {"Acta Informatica"}
  1016.  
  1017. MACRO {cacm} {"Communications of the ACM"}
  1018.  
  1019. MACRO {ibmjrd} {"IBM Journal of Research and Development"}
  1020.  
  1021. MACRO {ibmsj} {"IBM Systems Journal"}
  1022.  
  1023. MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
  1024.  
  1025. MACRO {ieeetc} {"IEEE Transactions on Computers"}
  1026.  
  1027. MACRO {ieeetcad}
  1028.  {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
  1029.  
  1030. MACRO {ipl} {"Information Processing Letters"}
  1031.  
  1032. MACRO {jacm} {"Journal of the ACM"}
  1033.  
  1034. MACRO {jcss} {"Journal of Computer and System Sciences"}
  1035.  
  1036. MACRO {scp} {"Science of Computer Programming"}
  1037.  
  1038. MACRO {sicomp} {"SIAM Journal on Computing"}
  1039.  
  1040. MACRO {tocs} {"ACM Transactions on Computer Systems"}
  1041.  
  1042. MACRO {tods} {"ACM Transactions on Database Systems"}
  1043.  
  1044. MACRO {tog} {"ACM Transactions on Graphics"}
  1045.  
  1046. MACRO {toms} {"ACM Transactions on Mathematical Software"}
  1047.  
  1048. MACRO {toois} {"ACM Transactions on Office Information Systems"}
  1049.  
  1050. MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
  1051.  
  1052. MACRO {tcs} {"Theoretical Computer Science"}
  1053.  
  1054. READ
  1055.  
  1056. EXECUTE {init.field.constants}
  1057.  
  1058. FUNCTION {sortify}
  1059. { purify$
  1060.   "l" change.case$
  1061. }
  1062.  
  1063. FUNCTION {sortify.names}
  1064. { " \harvardand\ " " " replace.substring
  1065.   " et~al." " zzz" replace.substring
  1066.   sortify
  1067. }
  1068.  
  1069. FUNCTION {author.key.label}
  1070. { author empty$
  1071.     { key empty$
  1072.     { title.field 'field.used := }
  1073.     { key.field 'field.used := }
  1074.       if$
  1075.     }
  1076.     { author.field 'field.used := }
  1077.   if$
  1078. }
  1079.  
  1080. FUNCTION {author.editor.key.label}
  1081. { author empty$
  1082.     { editor empty$
  1083.     { key empty$
  1084.         { title.field 'field.used := }
  1085.         { key.field 'field.used := }
  1086.       if$
  1087.       }
  1088.     { editor.field 'field.used := }
  1089.       if$
  1090.     }
  1091.     { author.field 'field.used := }
  1092.   if$
  1093. }
  1094.  
  1095. FUNCTION {author.key.organization.label}
  1096. { author empty$
  1097.     { key empty$
  1098.     { organization empty$
  1099.         { title.field 'field.used := }
  1100.         { organization.field 'field.used := }
  1101.       if$
  1102.     }
  1103.     { key.field 'field.used := }
  1104.       if$
  1105.     }
  1106.     { author.field 'field.used := }
  1107.   if$
  1108. }
  1109.  
  1110. FUNCTION {editor.key.organization.label}
  1111. { editor empty$
  1112.     { key empty$
  1113.     { organization empty$
  1114.         { title.field 'field.used := }
  1115.         { organization.field 'field.used := }
  1116.       if$
  1117.     }
  1118.     { key.field 'field.used := }
  1119.       if$
  1120.     }
  1121.     { editor.field 'field.used := }
  1122.   if$
  1123. }
  1124.  
  1125. FUNCTION {sort.format.title}
  1126. { 't :=
  1127.   "A " #2
  1128.     "An " #3
  1129.       "The " #4 t chop.word
  1130.     chop.word
  1131.   chop.word
  1132.   sortify
  1133.   #1 global.max$ substring$
  1134. }
  1135.  
  1136. FUNCTION {calc.label} %%%XXX change
  1137. { make.abbr.label
  1138.   title.field field.used =
  1139.     { sort.format.title }
  1140.     { sortify.names }
  1141.   if$
  1142.   year field.or.null purify$ #-1 #4 substring$ sortify
  1143.   *
  1144.   'sort.label :=
  1145. }
  1146.  
  1147. FUNCTION {preliminaries} %%%XXX change
  1148. { type$ "book" =
  1149.   type$ "inbook" =
  1150.   or
  1151.     'author.editor.key.label
  1152.     { type$ "proceedings" =
  1153.     'editor.key.organization.label
  1154.     { type$ "manual" =
  1155.         'author.key.organization.label
  1156.         'author.key.label
  1157.       if$
  1158.     }
  1159.       if$
  1160.     }
  1161.   if$
  1162.   author.field field.used = %%%XXX change
  1163.     {
  1164.       author num.names$ #2 >
  1165.         { #1 }
  1166.         { #0 }
  1167.       if$
  1168.       'etal.required :=
  1169.     }
  1170.     {
  1171.       editor.field field.used = 
  1172.         {
  1173.           editor num.names$ #2 >
  1174.             { #1 }
  1175.             { #0 }
  1176.           if$
  1177.         }
  1178.         { #0 }
  1179.       if$
  1180.       'etal.required :=
  1181.     }
  1182.   if$
  1183.   #1 'etal.allowed :=
  1184. }
  1185.  
  1186. FUNCTION {first.presort}
  1187. { calc.label
  1188.   sort.label
  1189.   title.field field.used =
  1190.     { skip$ }
  1191.     { "    "
  1192.       *
  1193.       make.list.label sortify.names
  1194.       *
  1195.       "    "
  1196.       *
  1197.       title field.or.null
  1198.       sort.format.title
  1199.       *
  1200.     }
  1201.   if$
  1202.   #1 entry.max$ substring$
  1203.   'sort.key$ :=
  1204. }
  1205.  
  1206. ITERATE {preliminaries}
  1207.  
  1208. ITERATE {first.presort}
  1209.  
  1210. SORT
  1211.  
  1212. STRINGS { last.sort.label next.extra last.full.label}
  1213.  
  1214. INTEGERS { last.extra.num last.etal.allowed}
  1215.  
  1216. FUNCTION {initialize.confusion}
  1217. { #0 int.to.chr$ 'last.sort.label :=
  1218.   #0 int.to.chr$ 'last.full.label :=
  1219.   #1 'last.etal.allowed :=
  1220. }
  1221.  
  1222. FUNCTION {confusion.pass}
  1223. { last.sort.label sort.label =
  1224.     { last.etal.allowed 
  1225.         { last.full.label make.full.label sortify.names =
  1226.             { skip$ }
  1227.             { #0 'etal.allowed :=
  1228.               #0 'last.etal.allowed :=
  1229.             }
  1230.           if$
  1231.         }
  1232.         { #0 'etal.allowed := }
  1233.       if$
  1234.     }
  1235.     { sort.label 'last.sort.label :=
  1236.       make.full.label sortify.names 'last.full.label :=
  1237.       #1 'last.etal.allowed :=
  1238.     }
  1239.   if$
  1240. }
  1241.  
  1242. EXECUTE {initialize.confusion}
  1243.  
  1244. ITERATE {confusion.pass}
  1245.  
  1246. EXECUTE {initialize.confusion}
  1247.  
  1248. REVERSE {confusion.pass}
  1249.  
  1250. FUNCTION {initialize.last.extra.num}
  1251. { #0 int.to.chr$ 'last.sort.label :=
  1252.   "" 'next.extra :=
  1253.   #0 'last.extra.num :=
  1254. }
  1255.  
  1256. FUNCTION {forward.pass}
  1257. { last.sort.label sort.label =
  1258.     { last.extra.num #1 + 'last.extra.num :=
  1259.       last.extra.num int.to.chr$ 'extra.label :=
  1260.     }
  1261.     { "a" chr.to.int$ 'last.extra.num :=
  1262.       "" 'extra.label :=
  1263.       sort.label 'last.sort.label :=
  1264.     }
  1265.   if$
  1266. }
  1267.  
  1268. FUNCTION {reverse.pass}
  1269. { next.extra "b" =
  1270.     { "a" 'extra.label := }
  1271.     'skip$
  1272.   if$
  1273.   year empty$
  1274.     { "n.d." extra.label emphasize * 'list.year := }
  1275.     { year extra.label emphasize * 'list.year := }
  1276.   if$
  1277.   extra.label 'next.extra :=
  1278. }
  1279.  
  1280. ITERATE {first.presort}
  1281.  
  1282. SORT
  1283.  
  1284. EXECUTE {initialize.last.extra.num}
  1285.  
  1286. ITERATE {forward.pass}
  1287.  
  1288. REVERSE {reverse.pass}
  1289.  
  1290. FUNCTION {second.presort}
  1291. { make.list.label
  1292.   title.field field.used =
  1293.     { sort.format.title }
  1294.     { sortify.names }
  1295.   if$
  1296.   "    "
  1297.   *
  1298.   list.year field.or.null sortify
  1299.   *
  1300.   "    "
  1301.   *
  1302.   title.field field.used =
  1303.     { skip$ }
  1304.     { title field.or.null
  1305.       sort.format.title
  1306.       *
  1307.     }
  1308.   if$
  1309.   #1 entry.max$ substring$
  1310.   'sort.key$ :=
  1311. }
  1312.  
  1313. ITERATE {second.presort}
  1314.  
  1315. SORT
  1316.  
  1317. FUNCTION {begin.bib}
  1318. { preamble$ empty$
  1319.     'skip$
  1320.     { preamble$ write$ newline$ }
  1321.   if$
  1322.   "\begin{thebibliography}{xx}" write$ newline$
  1323. }
  1324.  
  1325. EXECUTE {begin.bib}
  1326.  
  1327. EXECUTE {init.state.consts}
  1328.  
  1329. ITERATE {call.type$}
  1330.  
  1331. FUNCTION {end.bib}
  1332. { newline$
  1333.   "\end{thebibliography}" write$ newline$
  1334. }
  1335.  
  1336. EXECUTE {end.bib}
  1337.